package com.zzcy.bt_print_plugin.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;

import androidx.appcompat.widget.AppCompatTextView;


public class MyTableTextView_Mid extends AppCompatTextView {

    Paint paint = new Paint();

    public MyTableTextView_Mid(Context context, AttributeSet attrs) {
        super(context, attrs);
        int color = Color.parseColor("#666666");
        // 为边框设置颜色
        paint.setColor(color);
        // 设置边框宽度为2
        paint.setStrokeWidth(4);
    }

    int num=-1;

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        // 画TextView的4个边
        canvas.drawLine(0, 0, this.getWidth()+ num, 0, paint);
        canvas.drawLine(0, 0, 0, this.getHeight()+ num , paint);
        canvas.drawLine(this.getWidth()+ num , 0, this.getWidth()+ num , this.getHeight()+ num, paint);
        canvas.drawLine(0, this.getHeight()+ num, this.getWidth()+ num, this.getHeight()+ num, paint);

    }
}